package health.lm.com.find.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jakewharton.rxbinding2.view.RxView;
import com.lm.sjy.titlebar.widget.CommonTitleBar;

import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import health.lm.com.component_base.base.mvp.activity.XActivity;
import health.lm.com.find.R;
import health.lm.com.find.R2;
import health.lm.com.router.ARouterConstant;
import io.reactivex.functions.Consumer;

import static com.lm.sjy.titlebar.widget.CommonTitleBar.ACTION_LEFT_BUTTON;

/**
 * @author GQI
 * @description: 评价成功
 * @date :2019-08-14 14:56
 */
@Route(path = ARouterConstant.EvaluationSuccessActivity)
public class EvaluationSuccessActivity extends XActivity {
    @BindView(R2.id.title_bar)
    CommonTitleBar titlebar;
    @BindView(R2.id.tv_submit)
    TextView tvSubmit;

    @Override
    public int getLayoutId() {
        return R.layout.activity_evaluation_success;
    }

    @Override
    public Object newP() {
        return null;
    }

    @SuppressLint("CheckResult")
    @Override
    public void initData(Bundle savedInstanceState) {
        titlebar.setListener((v, action, extra) -> {
            if (action == ACTION_LEFT_BUTTON) {
                finish();
            }
        });
        RxView.clicks(tvSubmit)
                .throttleFirst(2, TimeUnit.SECONDS)
                .compose(bindToLife())
                .subscribe(new Consumer<Object>() {
                    @Override
                    public void accept(Object o) throws Exception {
                        finish();
                    }
                });
    }

}
